// Aula 3 - Configurando o PHP

# apt install php libapache2-mod-php php-mysql

# apt install php-curl php-json php-cgi

vim /etc/php/*/apache2/php.ini

max_input_time = 30
error_reporting = E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR
error_log = /var/log/php/error.log

# mkdir /var/log/php

# chown www-data /var/log/php

# systemctl restart apache2

vim /var/www/html/example.com/public_html/phptest.php 

<html>
<head>
    <title>PHP Test</title>
</head>
    <body>
    <?php echo '<p>Hello World</p>';

    // In the variables section below, replace user and password with your own MySQL credentials as created on your server
    $servername = "localhost";
    $username = "webuser";
    $password = "123456";

    // Create MySQL connection
    $conn = mysqli_connect($servername, $username, $password);

    // Check connection - if it fails, output will include the error message
    if (!$conn) {
        die('<p>Connection failed: <p>' . mysqli_connect_error());
    }
    echo '<p>Connected successfully</p>';
    ?>
</body>
</html>

# systemctl restart apache2

http://seuip/phptest.php












